/**
 * Created by shc@lierda.com on 2017/2/22.
 */
var React = require('react');
var Pingpai = require('../widget/Pingpai');
var Active = require('../components/Active');
var MsgBox = require('../components/MsgBox');
var ajax=require('../tools/ajax');


module.exports = React.createClass({
    getInitialState: function (){
        return {
            wxy:"",
            lfList:[],//左边列表
            lfDom:"",
            rtList:[],//右边列表
            rtDom:"",
            goods:{},
            limit:0,//二级分类数量限制
            cateId:"",//一级分类
            moreFlag:false//更多判断
        }
    },

    componentDidMount: function () {
        this.getProductCate();
    },

    render: function () {
        var p = this;
        var lfList = this.state.lfList;
        if(lfList) {
            var lfDom = lfList.map(function (o) {
                return (
                    <div key={o.id} className={o.id == p.state.wxy  ? "category_d active" : "category_d"} onClick={p.cate} data={o.id}>
                        <div>{o.cat_name}</div>
                    </div>
                )
            });
        }

        return (
            <div className="cate-con">
                <div className="cate-left">
                    {lfDom}
                </div>
                <div className="cate-right">
                    <ul className="gj-container">
                        {p.state.rtList}
                        <li className="more" onClick={p.more} style={{display:p.state.moreFlag?"none":"block"}}>更多</li>
                    </ul>
                </div>
                <MsgBox ref="MsgBox"></MsgBox>
            </div>
        )
    }
});